﻿package classes {
	
	import flash.display.Stage;
	
	public class Global {
		
		private static var _ins:Global; //单列
		private var _stageRef:Stage;
		private var _record:Object; //共享对象数据

		public function get stageRef():Stage {
			return _stageRef;
		}

		public function set stageRef(val:Stage):void {
			_stageRef = val;
		}

		public function get record():Object {
			return _record;
		}

		public function set record(_val:Object):void {
			_record = _val;
		}

		//------------------singleton---------------------
		public function Global(s:Singleton){
			if (_ins){
				throw new Error("pls getIns!");
			}
		}

		public static function getIns():Global {
			if (!_ins){
				_ins = new Global(new Singleton());
			}
			return _ins;
		}
	}
}

class Singleton {
	public function Singleton(){
	}
}







